#include "comm.hpp"


#define BUFFER_SIZE 1024
int main() {
    int shmid = getShareMem();  // 获取共享内存

    char* shmaddr = (char*)shmat(shmid, NULL, 0); // 将共享内存连接到当前进程的地址空间， 获取这段共享区域的起始地址
    if (shmaddr == (char*)-1) {
        log(Fatal, "attach share memory error");
        return -1;
    }
    log(Info, "attach share memory success");


    // 处理共享内存
    while (1) {
        char buffer[BUFFER_SIZE];
        cout << "Please Enter@: ";
        fgets(shmaddr, BUFFER_SIZE, stdin);  // 将共享内存的内容拷贝到缓冲区中

    }


    

    // 断开共享内存
    shmdt(shmaddr);

    return 0;
}